package misc

import (
	"go_gvm_mini/instructions/base"
	"go_gvm_mini/native"
	"go_gvm_mini/rtda"
)

func init() {
	native.Registers("sun/misc/VM", []*native.NaMethod{
		{
			"initialize",
			"()V",
			initialize,
		},
	})
}

// private native static void initialize();
func initialize(jFrame *rtda.JFrame) {
	classLoader := jFrame.Method().Class().GetClassLoader()
	jlSysClass := classLoader.LoadClass("java/lang/System")
	initSysCLass := jlSysClass.GetStaticMethod("initializeSystemClass", "()V")
	base.InvokeMethod(jFrame, initSysCLass)
}
